package com.bawei.yangzongcai___day2.MaiDongFangQi.day15.MMVVPP.V;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.bawei.yangzongcai___day2.MaiDongFangQi.day15.MMVVPP.P.mmvvppPretenter;

/**
 * create by ertu
 * create on 2021/8/2
 * description
 */
public abstract class BasemmvvppFragment<P extends mmvvppPretenter> extends Fragment implements mmvvppFragment,mmvvppView {
    protected P pqwe;
    private View view;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return view = inflater.inflate(bandlayoutmmvvpp(),container,false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        initmmvvppView();
        initmmvvppDate();
    }

    @Override
    public void showmmvvpp() {

    }

    @Override
    public void haidmmvvpp() {

    }

    @Override
    public void tostmmvvpp(String tosd) {
        Toast.makeText(getActivity(),tosd,Toast.LENGTH_SHORT).show();
    }

    @Override
    public <T extends View> T findbandidmmvvp(int id) {
        return view.findViewById(id);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (pqwe!=null)
        {

            pqwe=null;
            pqwe.dismmvvppPretenter();
        }
    }
}
